/**
 * 首页登录
 */
alert(222)
$(function () {
    layui.use(['form', 'layer'], function () {
        var form = layui.form;
        var layer = layui.layer;
        form.on("submit(login)", function () {
            login();
            return false;
        });
        var path = window.location.href;
        if (path.indexOf("kickout") > 0) {
            layer.alert("您的账号已在别处登录；若不是您本人操作，请立即修改密码！", function () {
                window.location.href = hostUrl + "/login";
            });
        }
    })
})

// 登录
function login() {
	debugger;
    var flag = true;
    if (flag != false) {
        $.axse(hostUrl + "/loginUser",
            $("#useLogin").serialize(),
            function (res) {
                if (res.status == 0) {
                    window.location.href = hostUrl + "/index";
                } else {
                    Layer.showFailMsg(res.msg);
                }
            },
            function () {
                Layer.showFailMsg("请求发送失败，请稍后重试");
            })
    }
}

// 参数校验
function checkParams() {
    //  校验
    var username = $("#username").val();
    var password = $("#password").val();
    if("ok"!=ValidateUtils.checkUserName(username) || "ok"!=ValidateUtils.checkSimplePassword(password)){
        Layer.showFailMsg("请您输入正确的用户名和密码");
        return false;
    }
}